package com.huitone.smspfm.core.waterpipe.client;

import java.util.HashMap;
import java.util.Map;

public abstract class AbstractorGateLinkRegister implements IGateLinkRegister {

	private Map<String, IGateLink> gateLinks = null;
	
	@Override
	public void register(String gateLinkId, IGateLink gateLink) {
		
		if (gateLinks == null) gateLinks = new HashMap<>();
		
		gateLinks.put(gateLinkId, gateLink);
		
	}

	@Override
	public IGateLink get(String gateLinkId) {
		
		IGateLink gateLink = null;
		
		if (gateLinks != null) {
			gateLink = gateLinks.get(gateLinkId);
		}
		
		return gateLink;
	}
	
	public Map<String,IGateLink> getGateLinks() {
		return gateLinks;
	}
	
	public void clear() {
		if (gateLinks != null) {
			gateLinks.clear();
		}
	}

	public void setGateLinks(Map<String, IGateLink> gateLinks) {
		this.gateLinks = gateLinks;
	}

}
